<?xml version="1.0" encoding="UTF-8"?>

<!--
  - Application context definition for JPetStore's business layer.
  - Contains bean references to the transaction manager and to the DAOs in
  - dataAccessContext-local/jta.xml (see web.xml's "contextConfigLocation").
  -->
<beans xmlns="http://www.springframework.org/schema/beans"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xmlns:aop="http://www.springframework.org/schema/aop"
		xmlns:tx="http://www.springframework.org/schema/tx"
		xsi:schemaLocation="
			http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
			http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
			http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
  
   <!-- ========================= GENERAL DEFINITIONS ======================== -->
   <import resource="${dataAccessContext}" />
     
    <!-- ========================= dao OBJECT DEFINITIONS ======================== -->
   <import resource="${applicationContextDao}" />
   
   <!-- ========================= BUSINESS OBJECT DEFINITIONS ======================== -->
   <import resource="${applicationContextService}" />
    <!-- ========================= web action OBJECT DEFINITIONS ======================== -->
   <import resource="${applicationContextAction}" />

	
   <!-- ========================= ASPECT CONFIGURATION ======================== -->

	<aop:config>
		<!--
			This definition creates auto-proxy infrastructure based on the given pointcut,
			expressed in AspectJ pointcut language. Here: applying the advice named
			"txAdvice" to all methods on classes named PetStoreImpl.
		-->
		<aop:advisor pointcut="execution(* *..*ServiceImpl.*(..))" advice-ref="txAdvice"/>

		<!--
			This definition creates auto-proxy infrastructure based on the given pointcut,
			expressed in AspectJ pointcut language. Here: applying the advice named
			"emailAdvice" to insertOrder(Order) method of PetStoreImpl
		-->
		<!--
		<aop:advisor pointcut="execution(* *..PetStoreFacade.insertOrder(*..Order))" advice-ref="emailAdvice"/>
		-->
	</aop:config>

	<!--
		Transaction advice definition, based on method name patterns.
		Defaults to PROPAGATION_REQUIRED for all methods whose name starts with
		"insert" or "update", and to PROPAGATION_REQUIRED with read-only hint
		for all other methods.
	-->
	<tx:advice id="txAdvice">
		<tx:attributes>
			<tx:method name="insert*"/>
			<tx:method name="create*"/>
			<tx:method name="update*"/>
			<tx:method name="delete*"/>
			<tx:method name="*" read-only="true"/>
		</tx:attributes>
	</tx:advice>

	

</beans>
